import java.util.Arrays;
public class quickSort {
    public static void main(String[] arges){
        int[] arr = {15, 65, 23, 35, 4, 10};
        int left = 0;
        int right = arr.length-1;
        quicksort(arr, left, right);
        System.out.println(Arrays.toString(arr));
    }
    public static void quicksort(int[] a, int left, int right){
        int i = left;
        int j = right;
        int key = a[i];
        while (i<j ){
            while (i<j && a[j]>=key){
                j--;
            }
            while (i<j && a[i]<=key){
                i++;
            }
            swap(a, i, j);// 交换两端不和谐的值

        }
            swap(a, 0, i);// 将key值放中间
            quicksort(a, left, i - 1);
            quicksort(a, i + 1, right);
        }
    public static void swap(int[] arr,int a,int b){
        int temp=arr[b];
        arr[b]=arr[a];
        arr[a] = temp;
    }
}
